import React from "react"
import Modal from 'antd/lib/modal/Modal'
import {connect} from 'umi'
import {Form,Input,Select} from "antd"
const SearchClient=(props:any)=>{
    const {showClientSearch}=props
    const [form]=Form.useForm()
    const {dispatch,model}=props
    const onCancel=()=>{
        dispatch({
            type: "itineraryInfo/save",
            payload: {
                showEdit: false,
                isEdit:false,
                showClientSearch:false
            }
        })
    }
    const onFinish=()=>{
            form.validateFields().then((values)=>{
                console.log(values)
                dispatch({
                    type:"itineraryInfo/searchClient",
                    payload:{
                        data:{...values}
                    }
                })
            })
    }
    return ( 
        <Modal visible={showClientSearch}  getContainer={false} title="查询乘客" onCancel={onCancel} onOk={onFinish} >
            <Form form={form} onFinish={onFinish}>
            <Form.Item label="姓名" name="fullname"rules={[{required:true,message:"请输入需要查询的姓名"}]} >    
                <Input placeholder="请输入姓名"/>  
            </Form.Item>
            <Form.Item label="身份证号" name="idno" rules={[{required:true,message:"请输入需要查询的姓名"}]}> 
                <Input placeholder="请输入身份证号"/>
            </Form.Item>
            </Form>
        </Modal>
    )
}
const mapStateToProps=(state:any)=>({
    model:state.itineraryInfo.current,
    showClientSearch:state.itineraryInfo.showClientSearch
})
export default connect(mapStateToProps)(SearchClient)